﻿/*************************************************************************
 * Created by OhZee Creative, LLC
 * 2013
 * This code is licensed under Microsoft Public License (Ms-PL)
 * http://opensource.org/licenses/ms-pl
 * http://ozcontrols.codeplex.com/
 *************************************************************************/

using Microsoft.Windows.Design.Metadata;

[assembly: ProvideMetadata(typeof(OhZeeCreative.Windows8.UI.Radials.Design.Metadata))]
namespace OhZeeCreative.Windows8.UI.Radials.Design
{
    extern alias RadialsLibrary;
    using System;
    using System.ComponentModel;
    using ControlsLibrary = RadialsLibrary::OhZeeCreative.UI.Controls;

    public class Metadata : IProvideAttributeTable
    {
        readonly string Appearance = CategoryAttribute.Appearance.Category;
        readonly string Layout = CategoryAttribute.Layout.Category;

        private static AttributeTable attributeTable;

        public AttributeTable AttributeTable
        {
            get
            {
                if (attributeTable == null)
                {
                    AttributeTableBuilder builder = new AttributeTableBuilder();

                    builder.AddTable(this.RadialControl);
                    builder.AddTable(this.RadialLayoutPanel);
                    builder.AddTable(this.RadialIndicator);
                    builder.AddTable(this.RadialRepeater);
                    
                    attributeTable = builder.CreateTable();
                }

                return attributeTable;
            }
        }

        private AttributeTable RadialControl
        {
            get
            {
				AttributeTableBuilder builder = new AttributeTableBuilder();

				Type type = typeof(ControlsLibrary.RadialControl);

                builder.AddCustomAttributes(type, "RadiusBegin", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "RadiusBegin", new DescriptionAttribute("Gets or sets the length of the radius at the start angle, in pixels."));

                builder.AddCustomAttributes(type, "RadiusEnd", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "RadiusEnd", new DescriptionAttribute("Gets or sets the length of the radius at the end angle, in pixels."));

				builder.AddCustomAttributes(type, "AngleBegin", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "AngleBegin", new DescriptionAttribute("Gets or sets the starting angle in degrees according to Cartesian coordinates."));

				builder.AddCustomAttributes(type, "AngleEnd", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "AngleEnd", new DescriptionAttribute("Gets or sets the ending angle in degrees according to Cartesian coordinates."));			

				builder.AddCustomAttributes(type, "ThicknessBegin", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "ThicknessBegin", new DescriptionAttribute("Gets or sets the thickness at the start angle, in pixels."));

				builder.AddCustomAttributes(type, "ThicknessEnd", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "ThicknessEnd", new DescriptionAttribute("Gets or sets the thickness at the end angle, in pixels."));

                builder.AddCustomAttributes(type, "Easing", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "Easing", new DescriptionAttribute("Gets or sets the easing that determines how intermediate values of radius and angle are calculated between start and end."));

                builder.AddCustomAttributes(type, "Points", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "Points", new DescriptionAttribute("Gets or sets the number of points used to draw the arc on one side. The bigger the number, the smoother the arc."));

                // builder.AddCustomAttributes(type, "Stroke", new CategoryAttribute(Brush));  // will go to Brush by default
                builder.AddCustomAttributes(type, "Stroke", new DescriptionAttribute("Gets or sets the brush used for the stroke."));

				builder.AddCustomAttributes(type, "StrokeThickness", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "StrokeThickness", new DescriptionAttribute("Gets or sets the thickness of the stroke, in pixels."));

                builder.AddCustomAttributes(type, "ShowCrosshairsAtOrigin", new CategoryAttribute(Layout));
                builder.AddCustomAttributes(type, "ShowCrosshairsAtOrigin", new DescriptionAttribute("Toggles the visibility of crosshairs at the origin."));                

                builder.AddCustomAttributes(type, "OriginX", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "OriginX", new DescriptionAttribute("Gets the X origin relative to the left of the shape area."));

                builder.AddCustomAttributes(type, "OriginY", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "OriginY", new DescriptionAttribute("Gets the Y origin relative to the top of the shape area."));

                builder.AddCustomAttributes(type, "CenterOrigin", new CategoryAttribute(Layout));
                builder.AddCustomAttributes(type, "CenterOrigin", new DescriptionAttribute("Determines whether the origin should be centered within the width and height of the control."));                
                
                builder.AddCustomAttributes(type, "ShapeWidth", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "ShapeWidth", new DescriptionAttribute("Gets the internal width of the shape."));

                builder.AddCustomAttributes(type, "ShapeHeight", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "ShapeHeight", new DescriptionAttribute("Gets the internal height of the shape."));
				
				return builder.CreateTable();
            }
        }

        private AttributeTable RadialLayoutPanel
        {
            get
            {
                AttributeTableBuilder builder = new AttributeTableBuilder();

                Type type = typeof(ControlsLibrary.RadialLayoutPanel);

                builder.AddCustomAttributes(type, "RadiusBegin", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "RadiusBegin", new DescriptionAttribute("Gets or sets the length of the radius at the start angle, in pixels."));

                builder.AddCustomAttributes(type, "RadiusEnd", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "RadiusEnd", new DescriptionAttribute("Gets or sets the length of the radius at the end angle, in pixels."));

                builder.AddCustomAttributes(type, "AngleBegin", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "AngleBegin", new DescriptionAttribute("Gets or sets the starting angle in degrees according to Cartesian coordinates."));

                builder.AddCustomAttributes(type, "AngleEnd", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "AngleEnd", new DescriptionAttribute("Gets or sets the ending angle in degrees according to Cartesian coordinates."));

                builder.AddCustomAttributes(type, "ChildAngleBegin", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "ChildAngleBegin", new DescriptionAttribute("Gets or sets the rotation in degrees of the first child element."));

                builder.AddCustomAttributes(type, "ChildAngleDelta", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "ChildAngleDelta", new DescriptionAttribute("Gets or sets the rotation in degrees of a child element relative to the previous one."));

                builder.AddCustomAttributes(type, "Easing", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "Easing", new DescriptionAttribute("Gets or sets the easing that determines how intermediate values of radius and angle are calculated between start and end."));

                builder.AddCustomAttributes(type, "ItemsSkipped", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "ItemsSkipped", new DescriptionAttribute("Gets or sets the number of initial child elements to omit from the layout."));

                builder.AddCustomAttributes(type, "ItemsMaximum", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "ItemsMaximum", new DescriptionAttribute("Gets or sets the maximum number of child elements to include in the layout."));

                builder.AddCustomAttributes(type, "OriginX", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "OriginX", new DescriptionAttribute("Gets the X origin relative to the left of the shape area."));

                builder.AddCustomAttributes(type, "OriginY", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "OriginY", new DescriptionAttribute("Gets the Y origin relative to the top of the shape area."));

                builder.AddCustomAttributes(type, "CenterOrigin", new CategoryAttribute(Layout));
                builder.AddCustomAttributes(type, "CenterOrigin", new DescriptionAttribute("Determines whether the origin should be centered within the width and height of the control."));                

                return builder.CreateTable();
            }
        }

        private AttributeTable RadialIndicator
        {
            get
            {
                AttributeTableBuilder builder = new AttributeTableBuilder();

                Type type = typeof(ControlsLibrary.RadialIndicator);

                builder.AddCustomAttributes(type, "ValueBegin", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "ValueBegin", new DescriptionAttribute("Gets or sets the value associated with the starting angle of the associated RadialControl."));

                builder.AddCustomAttributes(type, "Value", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "Value", new DescriptionAttribute("Gets or sets the current value of the indicator."));

                builder.AddCustomAttributes(type, "ValueEnd", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "ValueEnd", new DescriptionAttribute("Gets or sets the value associated with the end angle of the associated RadialControl."));

                builder.AddCustomAttributes(type, "RadiusBegin", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "RadiusBegin", new DescriptionAttribute("Gets or sets the length of the radius at the start angle, in pixels."));

                builder.AddCustomAttributes(type, "RadiusEnd", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "RadiusEnd", new DescriptionAttribute("Gets or sets the length of the radius at the end angle, in pixels."));

                builder.AddCustomAttributes(type, "AngleBegin", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "AngleBegin", new DescriptionAttribute("Gets or sets the starting angle in degrees according to Cartesian coordinates."));

                builder.AddCustomAttributes(type, "AngleEnd", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "AngleEnd", new DescriptionAttribute("Gets or sets the ending angle in degrees according to Cartesian coordinates."));

                builder.AddCustomAttributes(type, "ScalingEnabled", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "ScalingEnabled", new DescriptionAttribute("Toggles scaling of the indicator on/off."));

                builder.AddCustomAttributes(type, "OffsetX", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "OffsetX", new DescriptionAttribute("Gets or sets the horizontal offset of the indicator in pixels relative to the origin."));

                builder.AddCustomAttributes(type, "OffsetY", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "OffsetY", new DescriptionAttribute("Gets or sets the vertical offset of the indicator in pixels relative to the origin.")); 
                
                return builder.CreateTable();
            }
        }

        private AttributeTable RadialRepeater
        {
            get
            {
                AttributeTableBuilder builder = new AttributeTableBuilder();

                Type type = typeof(ControlsLibrary.RadialRepeater);

                builder.AddCustomAttributes(type, "RadiusBegin", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "RadiusBegin", new DescriptionAttribute("Gets or sets the length of the radius at the start angle, in pixels."));

                builder.AddCustomAttributes(type, "RadiusEnd", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "RadiusEnd", new DescriptionAttribute("Gets or sets the length of the radius at the end angle, in pixels."));

                builder.AddCustomAttributes(type, "AngleBegin", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "AngleBegin", new DescriptionAttribute("Gets or sets the starting angle in degrees according to Cartesian coordinates."));

                builder.AddCustomAttributes(type, "AngleEnd", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "AngleEnd", new DescriptionAttribute("Gets or sets the ending angle in degrees according to Cartesian coordinates."));

                builder.AddCustomAttributes(type, "ChildAngleBegin", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "ChildAngleBegin", new DescriptionAttribute("Gets or sets the rotation in degrees of the first item."));

                builder.AddCustomAttributes(type, "ChildAngleDelta", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "ChildAngleDelta", new DescriptionAttribute("Gets or sets the rotation in degrees of a child element relative to the previous one."));

                builder.AddCustomAttributes(type, "Easing", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "Easing", new DescriptionAttribute("Gets or sets the easing that determines how intermediate values of radius and angle are calculated between start and end."));

                builder.AddCustomAttributes(type, "ItemsSkipped", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "ItemsSkipped", new DescriptionAttribute("Gets or sets the number of initial items to omit from the layout."));

                builder.AddCustomAttributes(type, "ItemsMaximum", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "ItemsMaximum", new DescriptionAttribute("Gets or sets the maximum number of items to include in the layout."));

                builder.AddCustomAttributes(type, "Items", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "Items", new DescriptionAttribute("Gets or sets the number of items in the repeater."));

                builder.AddCustomAttributes(type, "OriginX", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "OriginX", new DescriptionAttribute("Gets the X origin relative to the left of the shape area."));

                builder.AddCustomAttributes(type, "OriginY", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "OriginY", new DescriptionAttribute("Gets the Y origin relative to the top of the shape area."));

                builder.AddCustomAttributes(type, "CenterOrigin", new CategoryAttribute(Layout));
                builder.AddCustomAttributes(type, "CenterOrigin", new DescriptionAttribute("Determines whether the origin should be centered within the width and height of the control."));                

                return builder.CreateTable();
            }
        }
    }
}
